// request.js
import axios from 'axios'

const httpService = axios.create({
    timeout: 5000 // 请求超时时间
})

// response interceptor
httpService.interceptors.response.use(
    response => {
        const res = response.data
        return res
    },
    error => {
        //alert('err' + error)
        //console.log('err' + error) // for debug
        return Promise.reject(error)
    }
)

httpService.all = axios.all

export default httpService